home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-ppc / doc / vbcc.faq < prev    next >
Text File  |  1999-01-01  |  10KB  |  241 lines

  1.  
  2. Frequently asked questions about vbcc (under work)
  3.  
  4.  
  5. GENERAL QUESTIONS
  6.  
  7. Q: vbcc has such a low version number whereas compiler x has a much higher
  8.    one. Does that mean that vbcc is very unstable?
  9. A: No. Version numbers are no measure for reliability.
  10.  
  11. Q: Is vbcc ANSI/ISO-compliant?
  12. A: For any practical purposes, yes.
  13.  
  14. Q: vbcc complains about my source files.
  15. A: While there might be an error in vbcc (see BUGREPORTS), usually the
  16.    source is no correct C. Check if it really is conforming C.
  17.  
  18.    Q: But it must be correct, because compiler xyz accepts it.
  19.    A: That doesn't mean a lot. Many compilers provide specific extensions
  20.       or accept sources that are no conforming C.
  21.  
  22.    Q: But I copied it straight from a textbook about C.
  23.    A: That doesn't mean a lot. Many books about C are very bad.
  24.  
  25.    Q: But my instructor said it was correct.
  26.    A: That doesn't mean a lot. Many instructors have never even seen the
  27.       standard for C.
  28.  
  29.    Q: What are good books, then?
  30.    A: Kernighan, Ritchie: The C Programming Language, 2nd edition is pretty
  31.       good.
  32.  
  33. Q: vbcc doesn't like //-comments?
  34. A: Yes, because there are no such comments in the current C standard.
  35.    However, the -+ option of vc makes vbcc accept them. But note that
  36.    this forces vbcc to break the ANSI standard. (And on AmigaOS be careful
  37.    with -+ at the end of the command line.)
  38.  
  39. Q: vbcc doesn't like long long?
  40. A: Yes, because there is no long long in the current C standard.
  41.    vbcc may implement long long in the future.
  42.  
  43. Q: Is C++-support planned?
  44. A: Currently not.
  45.  
  46. Q: Is C9X-support planned?
  47. A: Yes, but it depends on my free time.
  48.  
  49. Q: Is support for any other languages planned?
  50. A: Someone is thinking about/working on an Oberon frontend. But don't hold
  51.    your breath.
  52.  
  53. Q: How about supporting target x?
  54. A: I want to support as many targets as possible, but my time is limited
  55.    and usually I need to have such hardware to write a backend for it.
  56.    Also, if possible, there should already be an assembler and linker.
  57.  
  58.    Of course, the best way to get support for a certain target, is to write
  59.    a backend yourself. How to do it is documented somewhat in interface.doc
  60.    (not terribly well unfortunately) and I'll help you if you contact me.
  61.  
  62. Q: Can I specify registers to pass arguments to functions?
  63. A: Yes, with the __reg keyword. Have a look at vbcc.doc.
  64.  
  65. Q: Can I use inline-assembly with vbcc?
  66. A: Yes. Have a look at vbcc.doc.
  67.  
  68. Q: Can you add a warning for x?
  69. A: Perhaps. Just let me know what warnings you'd like. But first, try if
  70.    vbcc doesn't already have it. Not all of vbcc's warnings are activated
  71.    by default. Have a look at the corresponding section in vbcc.doc.
  72.  
  73. Q: Can you add precompiled header files?
  74. A: Currently vbcc uses a separate preprocessor which makes that feature
  75.    impossible. When I find the time to complete the builtin preprocessor,
  76.    I may add them.
  77.  
  78. Q: How about adding a feature x to the compiler?
  79. A: If you think you have a good idea for a new feature, let me know. But
  80.    the chances of getting it into vbcc depend on several factors:
  81.    - Of course the importance/impact of the feature is a main factor.
  82.    - Also, the amount of work to add it is crucial.
  83.    - It should be portable to all host systems.
  84.    - There are better chances if the feature is also portable to all
  85.      target systems.
  86.    - If it is target-specific it should be possible to add it by
  87.      only changing the corresponding backend. I try to avoid target
  88.      specific code anywhere else.
  89.    - If possible the feature should comply with the ANSI/ISO standard.
  90.  
  91. Q: I had a look at the source code of vbcc. Do you know what you're doing?
  92. A: Yes (mostly :-).
  93.  
  94. Q: vbcc<target> does not create executables but only assembly output.
  95. A: Don't call the compiler directly. Use the frontend vc.
  96.  
  97. Q: When I use the optimizer vbcc uses very much memory and takes much
  98.    longer to compile.
  99. A: This is normal. Especially with -O3.
  100.  
  101. Q: But it needs very very much time and memory when optimizing.
  102. A: This is probably still normal. Global optimizing is not simple.
  103.    Some things you can try:
  104.    - Don't use the optimizer or at least use it only for time-critical
  105.      functions. vbcc's code with default settings often is good enough.
  106.    - Use a lower optimization level, e.g. -O rather than -O2 or -O3.
  107.    - When using -O3 use lower settings for -inline-size and -unroll-size.
  108.    - When using -O2 or -O3 use lower settings for -maxoptpasses.
  109.    - Split up larger larger functions. The time and memory needed by the
  110.      optimizer grows more than linear with the size of functions. So
  111.      one large function takes longer to optimize than several small ones
  112.      (unless they are inlined, of course).
  113.  
  114. Q: I used the optimizer and the program got larger.
  115. A: This is normal. vbcc mainly optimizes for speed rather than size.
  116.    Especially with -O3 the code may get much larger due to function-inlining
  117.    and loop-unrolling.
  118.  
  119. Q: I used the optimizer and the program got slower.
  120. A: This can happen sometimes. It is not always possible to decide whether
  121.    a certain optimization is worthwile or not, so vbcc has to use certain
  122.    heuristics. E.g. vbcc will assume that loops will be executed often
  123.    and therefore try to reduce the amount of work to be done within the
  124.    loop. The code outside the loop is considered less important. If the loop
  125.    only gets executed very few times, the result might be worse than
  126.    unoptimized code.
  127.  
  128. Q: So what optimizations should I use?
  129. A: It's very hard to give a general answer. If possible, try them out.
  130.  
  131. Q: vbcc generates rather bad code for my source.
  132. A: This cannot always be avoided. vbcc is far from perfect. Feel free to send
  133.    me the code and explain what code you would have expected. But don't
  134.    get your hopes up too high. Usually I already know the most important
  135.    shortcomings of vbcc's code-generation, but fixing them often is not at
  136.    all trivial and my time is very limited.
  137.  
  138. Q: My program behaves differently when compiled with optimizations.
  139. A: Check if your program is really correct. The optimizer often exhibits
  140.    bugs in programs. Note that the layout of code and data can be completely
  141.    different when using the optimizer and that the optimizer works on a
  142.    pretty large scope. Therefore the cause of the error might be very far
  143.    from the location where the error occurs.
  144.    If you think your program is correct, see BUGREPORTS.
  145.  
  146.  
  147. AMIGA RELATED QUESTIONS
  148.  
  149. Q: When linking I get errors about __ieee<something> not found.
  150. A: When using floating point math you have to link with a math-library.
  151.    See vclib.doc.
  152.  
  153. Q: Can vbcc generate code for 68020/30/40/60 and/or FPU?
  154. A: Yes, see vbccm68k.doc and vclib.doc.
  155.  
  156. Q: Can vbcc generate inline-instructions for sin() etc. on 68881?
  157. A: Yes, have a look at vclib.doc.
  158.  
  159. Q: Can vbcc generate code for ELF/V.4 PPC?
  160. A: Yes, use +ppc and have a look at readme.vbcc.
  161.  
  162. Q: Can vbcc generate code for WarpOS PPC?
  163. A: Frank Wille is working on it.
  164.  
  165. Q: Can code generated by vbcc be linked together with that of other
  166.    Amiga compilers?
  167. A: Usually, yes. However there are some minor incompatibilities between
  168.    several Amiga compilers. Try to avoid passing structures and short
  169.    types (char, short, float). Also be careful with floating-point-arguments
  170.    to varargs-function.
  171.  
  172. Q: vbcc or some of the utilities crash on my machine.
  173. A: Is your stack set large enough? Otherwise see BUGREPORTS.
  174.  
  175. Q: I tried to #include <pragma/xyz.h>, <pragmas/xyz> or similar files
  176.    and only get lots of errors.
  177. A: Those files are compiler-specific and do not belong to vbcc. To use
  178.    library-functions, usually <clib/xyz_protos.h> should be included.
  179.    If you want vbcc to generate inline-library-calls you may include
  180.    the files <proto/xyz.h>. But note that those are vbcc-specific and
  181.    you have to use the ones that come with vbcc.
  182.  
  183. Q: How can I use other shared libraries?
  184. A: Those libraries should come with a so-called fd-file (with an .fd-suffix).
  185.    You have to create a link-library from those and link them to your
  186.    program. See vbccm68k:doc/fd2lib.doc or vbccppc:doc/fd2libPPC.doc on
  187.    how to create the library. Then copy the library to vlibm68k:foo.lib
  188.    or vlibppc:libfoo.a and add -lfoo when linking with vc.
  189.  
  190. Q: Can I write shared libraries with vbcc?
  191. A: Yes, there is an example (clib<something>.lha) on aminet that shows how
  192.    to write shared libraries for several compilers including vbcc.
  193.  
  194. Q: I need some Unix/POSIX-functions vc.lib does not provide.
  195. A: You can compile your program to use ixemul.library. Have a look at
  196.    machines/amiga68k/doc/ixemul.doc.
  197.  
  198. Q: Programs using clock() don't work.
  199. A: clock() should return the time used by the program or -1 if this
  200.    information is not available. On the Amiga it is not available so
  201.    vc.lib always returns -1.
  202.    You can link with extra.lib to get an alternative version of clock()
  203.    that returns a value reflecting the current time. This will make
  204.    most programs work but is not really what ANSI/ISO intends.
  205.  
  206. Q: Do programs compiled with vbcc work with Kickstart 1.3 or earlier?
  207. A: Not by default. It could be done by modifying the linker-lines in
  208.    vc.config and taking care of some other problems.
  209.  
  210.  
  211. BUGREPORTS
  212.  
  213. If you have a bug-report, send it to volker@vb.franken.de and include
  214. at least the following information where applicable/available:
  215.  
  216. - Configuration of the machine you are using, including OS-version,
  217.   CPU-type and amount of RAM.
  218.  
  219. - The version of vbcc you are using (type vbcc<target> without arguments
  220.   to get the version) and from where and when you got it.
  221.  
  222. - All source files (and maybe data files) necessary to reproduce the problem.
  223.   Try to isolate the problem as much as possible and trim it down as far
  224.   as you can. If you give me a large source there is little chance I can
  225.   tell if there is a problem with vbcc and fix it.
  226.  
  227. - The exact command-line you use to compile (preferrably with the -v option)
  228.   and the output during compilation.
  229.  
  230. - If the problem occurs when running the program, a detailed description how
  231.   to invoke it to reproduce the problem and a description of what happens,
  232.   and why you think this is incorrect/what you think should happen instead.
  233.  
  234. - If possible a commented assembly listing of the generated code with
  235.   some annotations explaining the problem.
  236.  
  237.  
  238. Volker Barthelmann                                      volker@vb.franken.de
  239.  
  240.  
  241.